<?php
    header("Content-type:text/html;charset=utf-8");
    $name=$_GET["name"];
	$tel=$_GET["tel"];
	$adress=$_GET["adress"];
	$prize=$_GET["prize"];
	//连接数据库
	mysql_connect(SAE_MYSQL_HOST_M.":".SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
	mysql_select_db(SAE_MYSQL_DB);
	mysql_query("set names utf8");
	//先判断这个人是否之前登记过
	$sql="select * from form where tel='{$tel}'";
    $result=mysql_query($sql);
	//如果登记过
	 if(mysql_num_rows($result)>0){
	 	 echo '您已登录过这个信息';
	 }else{
	 		$sql = "INSERT INTO form(name,tel,adress,jp) VALUES('{$name}','{$tel}','{$adress}','{$prize}')";
			mysql_query($sql);
			if(mysql_insert_id()>0){
		    echo '添加成功';
	        }else{
		    echo '添加失败';
	       }
	 }
	
?>